package gui;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.SpinnerAdapter;

import com.squareapp.R;

public class ImageAdapter extends BaseAdapter implements SpinnerAdapter {

	private Context context;
	
	public static Integer[] arenas = {
            R.drawable.arena_beira_rio,
            R.drawable.arena_amazonia,
            R.drawable.arena_da_baixada,
            R.drawable.arena_das_dunas,
            R.drawable.arena_fonte_nova,
            R.drawable.arena_pantanal,
            R.drawable.arena_pernambuco,
            R.drawable.arena_castelao,
            R.drawable.arena_corinthians,
            R.drawable.arena_maracana,
            R.drawable.arena_mineirao,
            R.drawable.arena_mane_garrincha
    };
	
	public static Integer[] nomesArenas = {
        R.string.arena1,
        R.string.arena2,
        R.string.arena3,
        R.string.arena4,
        R.string.arena5,
        R.string.arena6,
        R.string.arena7,
        R.string.arena8,
        R.string.arena9,
        R.string.arena10,
        R.string.arena11,
        R.string.arena12,
        
};
	
	public ImageAdapter(Context context) {
		this.context = context;
	}
	
	@Override
	public int getCount() {
		return arenas.length;
	}

	@Override
	public Object getItem(int arg0) {
		return arenas[arg0];
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View contentView, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ImageView imageView = null;
		if (contentView == null) {
			imageView = new ImageView(context);
			imageView.setLayoutParams(new Gallery.LayoutParams(130,110));
			imageView.setPadding(25, 25, 25, 25);
		} else {
			imageView = (ImageView)contentView;
		}
		
		imageView.setImageResource(arenas[position]);
		return imageView;
	}

}
